package org.pray.activity.prototype;

import java.util.ArrayList;

public class ProTest {
    public static void main(String[] args) throws CloneNotSupportedException {
        ArrayList<String> list = new ArrayList<>();
        list.add("BuildLike");
        ProToType proToType = ProToType
                .builder()
                .type("原型模式")
                .buildLike(list)
                .build();
        System.out.println(proToType);
        ProToType cloneType = (ProToType) proToType.clone();
        System.out.println(cloneType == proToType);// false
        System.out.println(proToType.getType() == cloneType.getType());// true,说明super这个接口对成员变量是浅拷贝
        System.out.println(proToType.getBuildLike() == cloneType.getBuildLike());// true,说明super这个接口对成员变量是浅拷贝
    }
}
